import requests from "./request";
import type { HomeVoiceActorRecomResType, VoiceActorDetailResType } from "../store/modules/voice/type";

// 首页声优推荐
export const homeRecommendVoiceActorApi = () =>
  requests<{}, HomeVoiceActorRecomResType>({
    url: '/voice/recommendActor',
    method: 'get'
  });

// 声优详情
export const voiceActorDetailApi = (id: number) =>
  requests<{}, VoiceActorDetailResType>({
    url: '/voice/user/detail',
    method: 'get',
    params: {
      id: id
    }
  });

export const homeRecommendVoicePackageApi = (page: number) =>
  requests<{}, any>({
    url: '/voice/package/list',
    method: 'get',
    params: {
      page: page
    }
  });

export const voicePackageDetailApi = (id: number) =>
  requests<{}, any>({
    url: '/voice/package/detail',
    method: 'get',
    params: {
      id: id
    }
  });

export const voicePackageCreateApi = (data) =>
  requests<{}, any>({
    url: '/voice/package/addPackage',
    method: 'post',
    data: {
      "name": data.name,
      "avatar": data.avatar,
      "intro": data.intro,
      "voiceList": data.voiceList
    }
  });

export const voicePackageCommentApi = (id: number, page: number) =>
  requests<{}, any>({
    url: '/voice/package/comments/list',
    method: 'get',
    params: {
      packageId: id,
      page: page
    }
  });

export const addVoicePackageCommentApi = (data) =>
  requests<{}, any>({
    url: '/voice/package/addComment',
    method: 'post',
    data: data
  });

export const thumpVoice = (id) =>
  requests<{}, any>({
    url: '/voice/thump',
    method: 'get',
    params: { id: id }
  });
export const cancelThumpVoice = (id) =>
  requests<{}, any>({
    url: '/voice/cancelThump',
    method: 'get',
    params: { id: id }
  });
export const getMyLike = () =>
  requests<{}, any>({
    url: '/voice/myLike',
    method: 'get',
  });
export const getNewPost = (page) =>
  requests<{}, any>({
    url: '/post/getNewVoiceList',
    method: 'get',
    params: { page: page }
  });